package com.dingding.special.user.driver.dao;

import java.util.List;

import com.dingding.common.core.base.dao.IBaseDao;
import com.dingding.common.core.beans.Userorder;
import com.dingding.common.core.beans.special.Specialuserposition;
import com.dingding.common.core.beans.special.Specialuservehicleinfo;
import com.dingding.common.core.beans.special.Userspecialorder;
import com.dingding.common.core.beans.special.UserspecialorderT;
import com.dingding.special.user.driver.dto.driverauth.ReqSpecialDriverAuth;
import com.dingding.special.user.driver.dto.onlinedriver.OLineDriverDto;
import com.dingding.special.user.driver.enums.CarAuthStatus;

/**
 * @Description:司机用户的服务dao
 * @author fengshuonan
 * @date 2016年8月19日 下午5:11:34
 * @version 叮叮搭车
 * @since 2.4
 */
public interface IDriverUserDao extends IBaseDao<Specialuserposition>{
	
	//根据城市获取所有在线司机的偏好信息
	/**
	 * modify by hufan 添加车辆等级字段
	 */
	String GET_ALL_DRIVERS_PREFER = "SELECT od.userId AS userId, od.appointOrderType AS appointOrderType,od.distanceFilter AS distanceFilter,sp.currentCity AS currentCity,sp.longitude AS longitude,sp.latitude AS latitude," + 
			"sp.supStatus AS supStatus,od.startTime AS startTime,od.endTime AS endTime,sui.telPhone,suv.`vehicleLevelId` FROM specialorderdesignateset od " + 
			"LEFT JOIN specialuserposition sp ON od.userId = sp.userId " + 
			"LEFT JOIN specialuserinfo sui ON sui.userId = sp.userId " + 
			"left join specialuservehicleinfo suv on od.userId = suv.userId " + 
			"WHERE suv.authType = 2 and sp.currentCity LIKE ? AND sp.supStatus = 1 ";
	
	//根据城市获取所有的在线出租车司机
	String ALL_ONLINE_TAXIS_BY_CITY = "SELECT od.userId AS userId, od.appointOrderType AS appointOrderType,od.distanceFilter AS distanceFilter,sp.currentCity AS currentCity,sp.longitude AS longitude,sp.latitude AS latitude," + 
			"sp.supStatus AS supStatus,od.startTime AS startTime,od.endTime AS endTime,sui.telPhone FROM specialorderdesignateset od " + 
			"LEFT JOIN specialuserposition sp ON od.userId = sp.userId " + 
			"LEFT JOIN specialuserinfo sui ON sui.userId = sp.userId " + 
			"left join specialuservehicleinfo suv on od.userId = suv.userId " + 
			"WHERE suv.authType = 3 and sp.currentCity LIKE ? AND sp.supStatus = 1 ";
			
	
	/**
	 * @Description:获取当天的在线时间并更新在线时间
	 * @param userId 用户id
	 * @author fengshuonan
	 * @return BigDecimal
	 * @since 2.4
	 */
	public double getTodayDrivingHours(String userId);
	
	/**
	 * @Description:获取司机当日成交订单
	 * @param userId 司机id
	 * @author fengshuonan
	 * @return List<Userspecialordert> 当日已完成订单
	 * @since 2.4
	 */
	public List<Userspecialorder> getTodayAllDealOrder(String userId);
	
	/**
	 * 
	 * @Title: getTodayAllDealTaxiOrder 
	 * @Description: 获取出租车司机当日成交订单
	 * @param userId 用户
	 * @author YHQ 
	 * @return List<Userorder>    返回类型
	 * 
	 */
	public List<Userorder> getTodayAllDealTaxiOrder(String userId);
	
	/**
	 * @Description:获取司机当日未完成订单
	 * @param userId 司机id
	 * @author fengshuonan
	 * @return List<Userspecialordert> 当日未完成订单
	 * @since 2.4
	 */
	public List<UserspecialorderT> getTodayAllUnDealOrder(String userId);
	
	/**
	 * @Description:获取出车状态
	 * @param userId 用户id
	 * @author fengshuonan
	 * @return int 出车状态（1：出车    2：收车）
	 * @since 2.4
	 */
	public int getOutCarStatus(String userId);
	
	/**
	 * @Description:获取司机当天所有的订单
	 * @param userId 用户id
	 * @author fengshuonan
	 * @return List<Userspecialorder> 所有订单的集合
	 * @since 2.4
	 */
	public List<Userspecialorder> getTodayAllOrders(String userId);
	
	
	/**
	 * @Description:获取某个城市当前所有在线车辆
	 * @param cityName 城市名称
	 * @author fengshuonan
	 * @return List<Specialuserposition> 专车司机位置集合
	 * @since 2.4
	 */
	public List<Specialuserposition> getAllCurrentDriversPosition(String cityName);
	
	
	/**
	 * @Description:获取当前城市所有出车状态的车辆的
	 * @param cityName
	 * @author fengshuonan
	 * @return List<OLineDriverDto>
	 * @since 2.4
	 */
	public List<OLineDriverDto> getAllOnlineDrivers(String cityName);
	
	
	/**
	 * @Description:获取处理订单类型为实时抢单的车主
	 * @param cityName 城市名称
	 * @author fengshuonan
	 * @return List<OLineDriverDto> 车主集合
	 * @since 2.4
	 */
	public List<OLineDriverDto> getRealTimeOnlineDrivers(String cityName);
	
	/**
	 * @Description:获取处理订单类型为非实时（预约）订单的车主
	 * @param cityName 城市名称
	 * @author fengshuonan
	 * @return List<OLineDriverDto> 车主集合
	 * @since 2.4
	 */
	public List<OLineDriverDto> getUnRealTimeOnlineDrivers(String cityName);
	
	
	/**
	 * @Description:获取用户的车辆认证信息
	 * @author fengshuonan
	 * @since 2.4
	 */
	public Specialuservehicleinfo getSpecialUserVehicleInfo(String userId);
	
	
	/**
	 * @Description:把车主的认证信息保存到数据库中
	 * @author fengshuonan
	 * @return boolean
	 * @since 2.4
	 */
	public Specialuservehicleinfo saveSpecialUserVehicleInfo(ReqSpecialDriverAuth reqSpecialDriverAuth);
	
	/**
	 * @Description:判断车牌号是否已经认证过
	 * @author fengshuonan
	 * @return boolean true 被认证过 false 没有被认证过
	 * @since 2.4
	 */
	public boolean isLisenceIsReg(String lisencePlate,String userId);
	
	/**
	 * @Description:改变车辆审核状态
	 * @param userId
	 * @param status
	 * @author fengshuonan
	 * @return boolean
	 * @since 2.4
	 */
	public boolean changeCarAuthStatus(String userId,CarAuthStatus status);
	
	/**
	 * @Description:添加车辆审核记录
	 * @author fengshuonan
	 * @since 2.4
	 */
	public void recordDriverAuth(Specialuservehicleinfo vehicleInfo);
	
	/**
	 * @Description 获取某个城市的所有在线的出租车司机
	 * @param city 城市名称
	 * @author fengshuonan
	 * @return List<OLineDriverDto> 在线的出租车司机
	 */
	public List<OLineDriverDto> getAllOnlineTaxiDrivers(String city);
}
